package com.ding.controller;

import javax.servlet.http.HttpServletRequest;

import org.activiti.engine.ActivitiException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.ding.utils.ExceptionUtils;

@ControllerAdvice
public class Advice {
	
	@ExceptionHandler(ActivitiException.class)//这里将BpmnError异常捕获
	public String activitiException(ActivitiException e,HttpServletRequest request,RedirectAttributes redirectAttributes) {//捕获异常,并返回当前页面
		ExceptionUtils.activitiException(e, redirectAttributes);
		return "redirect:"+request.getServletPath();
	}
}
